
#include <BFont>
#include <BWidget>
#include "member_BActionGroup.h"
#include "member_BAction.h"

using namespace BWE;

member_BActionGroup::member_BActionGroup(BActionGroup* actionGroup)
{
	boss = actionGroup;
	exclusive = true;
	selectMode = Select_Single;
}
member_BActionGroup::~member_BActionGroup()
{

}

void member_BActionGroup::slotActionChecked(BObject* object, const BValue& value)
{
	BAction* action = (BAction*)object;
	if (exclusive && !action->checked())
		return;
	if (selectMode == Select_Single)
	{
		for (int i = 0; i < actions.size(); i++)
		{
			if (actions[i] == action)
				continue;
			BAction* action = actions[i];
			if(action_member(action)->checked)
			{
				action_member(action)->checked = false;
			}
		}
		if (action->checked())
			checkedActions.append(action);
		else
			checkedActions.remove(action);
		boss->emit(Signal_Checked, action);
	}
	if (selectMode == Select_Multiple)
	{
		boss->emit(Signal_Checked, action);
	}
}
void member_BActionGroup::slotActionTriggler(BObject* object, const BValue& value)
{
	BAction* action = (BAction*)object;
	boss->emit(Signal_Triggered, action);
}
